package com.google.gwt.sample.dynatablerf.client;

import com.gargoylesoftware.htmlunit.javascript.host.Window;
import com.google.gwt.core.client.EntryPoint;
import com.google.gwt.dom.client.Style.Unit;
import com.google.gwt.user.client.ui.RootLayoutPanel;
import com.google.gwt.user.client.ui.VerticalPanel;
import com.google.gwt.user.client.ui.Widget;
import com.orange.links.client.DiagramController;

public class GrifoEntryPoint implements EntryPoint {

	private DiagramController currentController;
	private VerticalPanel mainPanel;

	@Override
	public void onModuleLoad() {
		mainPanel = new VerticalPanel();
		RootLayoutPanel.get().add(mainPanel);

		loadExample(new Example3());
	}

	private void loadExample(AbstractExample example) {
		// Create the drawing zone
		currentController = new DiagramController(Window.WINDOW_WIDTH,
				Window.WINDOW_HEIGHT);
		currentController.showGrid(true);

		example.setDiagramController(currentController);
		Widget w = example.asWidget();
		w.getElement().getStyle().setMargin(10, Unit.PX);
		w.getElement().getStyle().setProperty("border", "1px solid #cccccc");
		mainPanel.add(w);
		example.draw();
	}

}
